package test9;

import com.tyfspring.context.support.ClassPathXmlApplicationContext;
import org.junit.Test;

/**
 * @Description TODO
 * @Author shallow
 * @Date 2023/4/11 21:22
 */

public class test {
    @Test
    public void test(){
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:test9/spring.xml");
        applicationContext.registerShutdownHook();

        UserService userService = applicationContext.getBean("userService", UserService.class);
        String result = userService.queryUserInfo();
        System.out.println("result = " + result);
        System.out.println("getApplicationContext = " + userService.getApplicationContext());
        System.out.println("getBeanFactory = " + userService.getBeanFactory());
    }
}
